home *** CD-ROM | disk | FTP | other *** search
- function DiskFree(Drive: Byte): Single;
- var
- RootPath: array[0..4] of Char;
- RootPtr: PChar;
- SectorsPerCluster, BytesPerSector,
- FreeClusters, TotalClusters: Integer;
- SPC: Single;
- begin
- RootPtr := nil;
- if Drive > 0 then begin
- StrCopy(RootPath, æA:\Æ);
- RootPath[0] := Char(Drive + $40);
- RootPtr := RootPath;
- end;
- if GetDiskFreeSpace(RootPtr, SectorsPerCluster, BytesPerSector,
- FreeClusters, TotalClusters) then begin
- SPC := SectorsPerCluster;
- Result := SPC * BytesPerSector * FreeClusters
- end else
- Result := -1;
- end;
-